<script setup lang='ts'>
import { onMounted, ref } from 'vue';


const res1 = ref(null)
onMounted(() => {
    if (res1.value) {
        const dom = res1.value as HTMLButtonElement
        dom.onclick = () => {
            alert('你点击了')
        }
    }
})

</script>

<template>
    <button ref="res1">按钮</button>
</template>

<style scoped></style>